/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image
} from 'react-native';

/*-----导入外部的组件----*/
var DCMain = require('./DCMain');

var DCLaunch = React.createClass({
    render() {
        return (
            <Image source={{uri: 'launchimage'}} style={styles.launchStyle} />
        );
    },

    //复杂操作:定时器、网络请求
    componentDidMount(){
        //定时,隔两秒钟切换到main
        setTimeout(()=>{
            //页面跳转
            this.props.navigator.replace({
                component:DCMain, //具体路由的板块
            });
        },1000)
    }
});

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    launchStyle: {
        flex:1,
    }
});

//输出组件类
module.exports = DCLaunch;